<?php $document=$document->getFirstChild(); ?>

<course>
	<Front>
		<? $front=$document->getChildByTitle("Frontpage")->getFirstChild(); ?>
		<header><? echo $front->getTitle();?></header>
		<body><? echo $front->getBody();?></body>
		<? if ($front->hasImages()) { ?>
			<img src="<? echo $front->useFirstImage(); ?>"/>
		<? } ?>
	</Front>
	<Intro>
		<? $intro=$document->getChildByTitle("Intropage")->getFirstChild(); ?>
		<header><?php echo $intro->getTitle();?></header>
		<body><?php echo $intro->getBody();?></body>
		<? if ($intro->hasImages()) { ?>
			<img src="<? echo $intro->useFirstImage(); ?>"/>
		<? } ?>
	</Intro>

	<?php foreach($document->getChildByTitle("Inputpages")->getChildren() as $inputpage) { ?>
		<Input id="<?php echo $inputpage->getAttribute("id"); ?>">
			<header><?php echo $inputpage->getTitle(); ?></header>
			<body><?php echo $inputpage->getBody(); ?></body>
			<initial><?php echo $inputpage->getAttribute("initial"); ?></initial>
			<format><?php echo $inputpage->getAttribute("format"); ?></format>
			<range><?php echo $inputpage->getAttribute("range"); ?></range>

			<? if ($inputpage->hasAttribute("precision")) { ?>
				<precision><?php echo $inputpage->getAttribute("precision"); ?></precision>
			<? } ?>

			<? if ($inputpage->hasAttribute("decimals")) { ?>
				<decimals><?php echo $inputpage->getAttribute("decimals"); ?></decimals>
			<? } ?>

			<? if ($inputpage->hasImages()) { ?>
				<img src="<? echo $inputpage->useFirstImage(); ?>"/>
			<? } ?>
		</Input>
	<?php } ?>
</course>